Implantation into the LATEX context

The PLAIN-TEX implementation by Th. Reid is based on a redefined \output routine:
   \edef\oldoutput{\the\output}%
   \output={\the\outputpretest\ifoutput\oldoutput\fi}
   \outputpretest={\outputtrue}
If a Floating Figure is requested, the content of the \outputpretest token register is prepared to decide:
  1. if there is enough vertical space to set the Floating Figure,
  2. if setting of a Floating Figure is in progress or
  3. if indeed the current page has to be sent to the DVI file.
In general, TEX has to deal with more than one paragraph until a Floating Figure will be completely processed. During this process the redefined \output routine is called at the begin of every paragraph; this is done indirectly by expanding the control sequence \tryfig. Therefore, the \everypar token list is prepared by the following command sequence:
   \edef\oldeverypar{\the\everypar}
   \everypar={\tryfig\oldeverypar}
Now \tryfig triggers the (modified) \output routine, which then does the decisions and actions mentioned above.

Adopting this concept when using the macros in the LATEX context, we are faced with the following problems:

  1. At the time FLOATFIG.STY is read in, the \output routine is still undefined; its definition is retarded until \begin{document} will be expanded; so the redefinition of the \output routine has to be done after \begin{document} by the command \initfloatingfigs (see section `Known Problems' below).
  2. There are situations where LATEX decides to redefine the \everypar token list without saving of the former content; this occurs for instance when expanding a \section control sequence. We overcome this by redefining \everypar whenever the \floatingfigure environment is entered. Hence to avoid problems, a Floating Figure should be requested early enough before any sectioning control sequence (see also subsection `Misleading collision warnings').
    Furthermore, the concurrent definitions of \everypar are the reason why Floating Figures cannot move across section boundaries.